package com.example.finance_oa.service.impl;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.example.comment_oa.pojos.Amount;
import com.example.comment_oa.pojos.Standard;
import com.example.comment_oa.pojos_vo.AmountVo;
import com.example.comment_oa.pojos_vo.FybxVo;
import com.example.finance_oa.mapper.StandardMapper;
import com.example.finance_oa.service.AmountService;
import com.example.finance_oa.mapper.AmountMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author Jin
 * @description 针对表【amount】的数据库操作Service实现
 * @createDate 2022-10-18 15:59:05
 */
@Service
public class AmountServiceImpl extends ServiceImpl<AmountMapper, Amount>
        implements AmountService{
    @Autowired
    AmountMapper amountMapper;
    @Autowired
    StandardMapper standardMapper;
    @Override
    public List<Amount> allAmount(AmountVo amountVo) {

        return amountMapper.allAmount(amountVo);
    }

    @Override
    public List<Amount> sumamountMoney1(int empId) {
        return amountMapper.sumamountMoney1(empId);
    }

    @Override
    public List<Amount> sumamountMoney2(int empId) {
        return amountMapper.sumamountMoney2(empId);
    }


    //费用报销流程发起
    @Override
    public int Fybxlc(FybxVo fybxVo) {
            List<Standard> list1=standardMapper.standardBykm(fybxVo.getBudgetKm());
        Date date = new Date(String.valueOf(fybxVo.getBudgetTime()));
        String year = DateUtil.format(date, "yyyy");
        String month = DateUtil.format(date, "MM");
        if(list1.size()>0){
            System.out.println(year+""+month);
            if(fybxVo.getBudgetKm().equals("住宿费")){

            }
        }else{
            System.out.println("陈俊林");
            System.out.println(fybxVo.getBudgetKm());
        }
        return 1;
    }

    @Override
    public List<Standard> selectStandard(String budgetKm) {

        return standardMapper.standardBykm(budgetKm);
    }

    //根据流程编号查询详细信息
    @Override
    public List<Amount> amountXb(String amountProcess) {
        return amountMapper.amountXb(amountProcess);
    }
}




